package com.ruoyi.finance.collection.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.finance.collection.domain.vo.ChargeElementsVo;
import com.ruoyi.finance.collection.mapper.ChargeElementMapper;
import com.ruoyi.finance.collection.service.ChargeElementService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fuzhen-pc
 * @description TODO
 * @date 2023/7/10 9:13
 */
@Service
public class ChargeElementServiceImpl extends ServiceImpl<ChargeElementMapper, ChargeElementsVo> implements ChargeElementService {

    //根据项目ID和项目类型查询计费要素
    @Override
    public List<ChargeElementsVo> selectByProjectIdAndType(Long projectId, String projectType) {
        return baseMapper.selectByProjectIdAndType(projectId, projectType);
    }

    /**
     * 从UNCONFIRMED_CHARGE_ELEMENTS表中查询计费要素
     * @param projectType
     * @return
     */
    @Override
    public List<ChargeElementsVo> selectByProjectIdAndTypeFromTable(String projectType) {
        return baseMapper.selectByProjectIdAndTypeFromTable(projectType);
    }

    /**
     * 从V_CHARGE_ELEMENTS_COLLECTION视图中查询计费要素
     * 用于UNCONFIRMED_CHARGE_ELEMENTS表中查询不到对应计费要素时，返回视图查询计费要素
     * @param projectType
     * @param projectId
     * @return
     */
    @Override
    public List<ChargeElementsVo> selectByProjectIdAndTypeFromView(String projectType, Long projectId) {
        return baseMapper.selectByProjectIdAndTypeFromView(projectType,projectId);
    }
}
